import {  Message } from "element-ui";
export default {
  install(Vue, options) {
    Vue.prototype.$copy = val => {
      let addInp = document.createElement("input");
      document.body.appendChild(addInp);
      addInp.value = val;
      addInp.select(); // 选择对象用户定义的代码区域
      document.execCommand("Copy"); //原生copy方法执行浏览器复制命令
      addInp.remove();
      Message({ type: "success", message: "复制成功" });
    };
    Vue.prototype.$getImageUrl = filePath => {
      let uploadsUrl = process.env.VUE_APP_BASE_API;
      if (!filePath) {
        return uploadsUrl;
      } else if (filePath.indexOf("http") == 0) {
        return filePath;
      } else {
        return uploadsUrl + "/uploads/" + filePath;
      }
    };
  }
};
